import { getQuestionnaireList } from '@/api';
import { questionnaireStatusOptions } from '@/common';
import TableSearch from '@/components/TableSearch';
import { Button, Card, DatePicker, Form, Input, Modal, Radio, Select, Table } from '@aurum/pfe-ui';
import { usePagination } from 'ahooks';
import { useCallback, useEffect, useMemo, useState } from 'react';

import React from 'react';
import { PageContainer } from 'pfe-ui';
import DialogFramework from './components/DialogFramework';
import ScoreConfig from './components/ScoreConfig';

const DialogFramework = ({ form }) => {
  const handleAIGenerate = async () => {
    const result = await generateByAI(form.getValues());
    form.setFieldsValue({ steps: result });
  };

  return (
    <div className="dialog-framework">
      <AIGenerateButton onClick={handleAIGenerate} />
      
      <Repeater name="steps">
        {(fields, { add, remove }) => (
          <>
            {fields.map((field) => (
              <InputGroup key={field.key}>
                <Form.Input {...field} name={[field.name, 'title']} />
                <Form.TextArea {...field} name={[field.name, 'content']} />
                <RemoveButton onClick={() => remove(field.name)} />
              </InputGroup>
            ))}
            <AddButton onClick={() => add({ title: '', content: '' })} />
          </>
        )}
      </Repeater>
    </div>
  );
};
